#include"producer.h"
#include"c3pom/application.h"
#include<unistd.h>
#include<iostream>
#include<stdlib.h>
using namespace std;
using namespace c3pom;
bool runing=true;
int producer::load()
{
	Application::getInstance()->regCommand(new Sayhello());
	portal=PortalManager::getInstance()->findPortal("customer.test");
}

int producer::run(vector<string>)
{
	while(portal!=NULL)
	{
		PortalBlock* pb=new PortalBlock(string("this is a message from producer"),"producer");
		(*portal)<<pb;
		sleep(1);
	}
}

int producer::stop(vector<string>)
{
	runing=false;
}

int Sayhello::exec(vector<string>)
{
	Object o;
	cout<<"hello,i am from producer!"<<endl;
}

string Sayhello::name()
{
	return "sayhello";
}

string Sayhello::desc()
{
	return "来自producer插件注册的测试命令";
}
